
//Copyright 1997-2009 Syrinx Development, Inc.
//This file is part of the Syrinx Web Application Framework (SWAF).
// == BEGIN LICENSE ==
//
// Licensed under the terms of any of the following licenses at your
// choice:
//
//  - GNU General Public License Version 3 or later (the "GPL")
//    http://www.gnu.org/licenses/gpl.html
//
//  - GNU Lesser General Public License Version 3 or later (the "LGPL")
//    http://www.gnu.org/licenses/lgpl.html
//
//  - Mozilla Public License Version 1.1 or later (the "MPL")
//    http://www.mozilla.org/MPL/MPL-1.1.html
//
// == END LICENSE ==
using System;
using System.Collections.Generic;
using System.Text;

using Swaf.BizObj;
using Swaf.Gui.AspNet2;

namespace Calendars.Gui.AspNet
{
    public class BasicCalendarItemDisplay : ComplexBizObjListDisplay, ICalendarItemDisplay
    {
        protected DateTime m_firstDate;
        protected string m_dateField;

        public void updateDayCellCssStyle(ref string cellStyle)
        {
            //Intentionally left blank.  Default behavior for this class is not to modify the cell's CSS.
        }

        public void updateDayCellCssClass(ref string cellClass)
        {
            //Intentionally left blank.  Default behavior for this class is not to modify the cell's CSS.
        }

        public void show(IBizObj partnerInfo, IBizObjCursor listItem)
        {
            m_dateField = partnerInfo.get("dateField").ToString();
            m_firstDate = (DateTime)listItem.currentElement.get(m_dateField);
            m_firstDate = new DateTime(m_firstDate.Year, m_firstDate.Month, m_firstDate.Day);
            ReadOnlyTemplate = partnerInfo.get("readOnlyTemplate").ToString();
            showBizObjs(null,listItem);
        }

        protected override bool keepProcessingList(Swaf.Gui.AspNet2.HtmlBlockInfo info)
        {
            DateTime d = (DateTime)m_bizObjCursor.currentElement.get(m_dateField);
            d = new DateTime(d.Year,d.Month, d.Day);
            return d.Equals(m_firstDate);
        }
    }
}
